import os

from database.mapper import stock_monitor
from database.service import monitor_result_service
from service.strategy_service import Strategy1
from utils import parse_util, excel_util, read_config


# 验证大资金
def yz_comprehensive():
    print('验证大资金')
    uast = stock_monitor.select_all('tbX50i9')
    all_list = []
    for ums in uast:
        s_code = ums.get('code')
        task_c_list = monitor_result_service.query_task_c_by_code(s_code)
        strategy = Strategy1('策略1', task_c_list)
        strategy.code = s_code
        strategy.stock_name = ums.get('name')
        strategy.execute()
        all_list += strategy.result.deal_info
    excel_util.gen_an_excel(os.path.join(read_config.data_path, 'result', 'h验证'), '监控h验证', '',
                            parse_util.list_dict_to_arr(all_list))


if __name__ == '__main__':
    yz_comprehensive()
